package com.jiechuang.common.web;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ApiModel
@Data
public class Response<T> {

    /** 返回码 */
    @ApiModelProperty(position = 1, value = "返回码")
    private int code;
    /** 返回文字内容 */
    @ApiModelProperty(position = 2, value = "返回信息")
    private String message;
    /** 返回实体对象 */
    @ApiModelProperty(position = 3, value = "返回体")
    private T obj;


    public Response(int code, String message, T obj) {
        this.code = code;
        this.message = message;
        this.obj = obj;
    }

    public Response(int code, String message) {
        this.code = code;
        this.message = message;
    }
    public Response(Code code,T obj){
        this.code=code.getCode();
        this.message=code.getMsg();
        this.obj=obj;
    }
    public Response(Code code){
        this.code=code.getCode();
        this.message=code.getMsg();

    }

}

